﻿<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<!DOCTYPE html>
<html>
<jsp:include page="../common/resource-head.jsp"/>
<body>
<jsp:include page="../common/common-top.jsp"/>
<div class="main-body">
  <div class="panel panel-primary">
    <div class="panel-heading text-center">订单管理</div>
    <div class="panel-body">
      <div class="row">
        <div class="col-xs-12">
          <div class="form-search">
            <form role="form" class="form-inline clearfix" id="form" action="">
              <div class="input-group">
                <span class="input-group-addon">用户</span>
                <input type="text" class="form-control" name="username" value="${username}">
              </div>
              <div class="form-tool btn-group">
                <button class="btn btn-sm btn-success" form="form">
                  <i class="icon-search"></i>搜索
                </button>
              </div>
            </form>
          </div>
          <div class="table-responsive">
            <table id="sample-table-1" class="table table-striped table-bordered table-hover">
              <thead>
              <tr>
                <th>订单号</th>
                <th>用户</th>
                <th>联系方式</th>
                <th>备注</th>
                <th>总金额</th>
                <th>状态</th>
                <th>明细</th>
                <th>下单时间</th>
                <th>操作</th>
              </tr>
              </thead>
              <tbody>
              <c:forEach items="${pageInfo.list}" var="item">
                <tr>
                  <td>${item.id}</td>
                  <td>${item.username}</td>
                  <td>${item.phone}</td>
                  <td>${item.remark}</td>
                  <td>${item.money}元</td>
                  <td>${item.status}</td>
                  <td>
                    <table class="table table-striped table-bordered table-hover">
                      <thead>
                      <tr>
                        <th>图书名</th>
                        <th>数量</th>
                        <th>总金额</th>
                      </tr>
                      </thead>
                      <tbody>
                      <c:forEach items="${item.itemList}" var="node">
                        <tr>
                          <td>${node.goodsName}</td>
                          <td>${node.num}</td>
                          <td>${node.num * node.goodsMoney}元</td>
                        </tr>
                      </c:forEach>
                      </tbody>
                    </table>
                  </td>
                  <td><fmt:formatDate value="${item.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                  <td>
                    <c:if test="${item.status == '待发货'}">
                      <a class="btn btn-xs btn-info" href="/admin/orders/detail/${item.id}">修改</a>
                      <button class="btn btn-xs btn-primary"
                              onclick="if(confirm('确定已发货吗？')){location.href='/admin/orders/send/${item.id}'}">
                        发货
                      </button>
                    </c:if>

                    <button class="btn btn-xs btn-success"
                            onclick="alert('${item.comment}')">
                      查看评论
                    </button>

                    <button class="btn btn-xs btn-danger"
                            onclick="if(confirm('确定要删除吗？')){location.href='/admin/orders/delete/${item.id}'}">
                      删除
                    </button>

                  </td>
                </tr>
              </c:forEach>
              </tbody>
            </table>
            <jsp:include page="../common/table-page.jsp"/>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

</body>
<jsp:include page="../common/resource-script.jsp"/>
</html>

